﻿using System;
using System.ComponentModel;

namespace NanoMvvm.ComponentModel
{
    internal class DynamicViewModelTypeDescriptionProvider : TypeDescriptionProvider
    {
        public DynamicViewModelTypeDescriptionProvider(Type t)
            : base(TypeDescriptor.GetProvider(t))
        {
        }

        public override ICustomTypeDescriptor GetTypeDescriptor(Type objectType, object instance)
        {
            return new DynamicViewModelTypeDescriptor(base.GetTypeDescriptor(objectType, instance), (IDynamicObject)instance);
        }
    }
}